<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="page/common/zTreeStyle.css" />
		<script type="text/javascript" src="page/common/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="page/common/jquery.ztree.core.js"></script>
		<script type="text/javascript" src="page/common/jquery.ztree.excheck.js"></script>
	</head>

	<body>

		<script type="text/javascript">
			var setting = {
				check: {
					enable: true
				},
				data: {
					simpleData: {
						enable: true
					}
				}
			};

			var zNodes = [{
					id: 1,
					pId: 1,
					name: "随意勾选 1",
					open: true
				},
				{
					id: 1,
					pId: null,
					name: "随意勾选 1",
					open: true
				},
				{
					id: 11,
					pId: null,
					name: "随意勾选 1-1",
					open: true
				},
				{
					id: 12,
					pId: null,
					name: "随意勾选 1-1",
					open: true
				},

			];

			$(document).ready(function() {
				$.fn.zTree.init($("#resclass1"), setting, zNodes);

			});
			 function onCheck(e,treeId,treeNode){
            var treeObj=$.fn.zTree.getZTreeObj("resclass1"),
            nodes=treeObj.getCheckedNodes(true),
            v="";
            for(var i=0;i<nodes.length;i++){
            v+=nodes[i].name + ",";
            }
            
            
            }
		</script>
		<ul id="resclass1"  class="ztree">

		</ul>
		<button onclick="onCheck()" type="button">按钮</button>
	</body>

</html>